import  request from '../../../utile/request.js'

const state = {
	homedata: {}
}

const mutations = {
	SETHOMEDATA(state,val){
		state.homedata=val
	}
}

const actions = {
	async gethomedata({commit}){
		const re = await request("/getIndexData")
		if(re.code===200){
			commit("SETHOMEDATA",re.data)
		}
	}
}

const getters = {
	bannerList(state){
		return (state.homedata||{}).bannerList||[]
	},
	iconDtoList(state){
		return (state.homedata||{}).iconDtoList||[]
	},
	sectionDtoList(state){
		return (state.homedata||{}).sectionDtoList||[]
	},
	sectionImgList(state){
		return (state.homedata||{}).sectionImgList||[]
	}
}

export default {
	state,
	mutations,
	actions,
	getters,
	namespaced: true,
}
